﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.CSS
{
    #region Using Statements
    
    using KLF.Lib.Browser.DOM;

    #endregion

    /// <summary>
    /// The CSSValue interface represents a simple or a complex value. 
    /// A CSSValue object only occurs in a context of a CSS property.
    /// </summary>
    public class CSSValue
    {
        #region Constants

        public const short CSS_INHERIT = 0;
        public const short CSS_PRIMITIVE_VALUE = 1;
        public const short CSS_VALUE_LIST = 2;
        public const short CSS_CUSTOM = 3;

        #endregion

        #region Constructors

        internal CSSValue()
        {
            PropertyPriority = "";
        }

        #endregion

        #region Attributes
        /// <summary>
        /// 
        /// </summary>
        internal string PropertyPriority { get; set; }

        #endregion

        #region DOM Level 2 CSS Compliance

        /// <summary>
        /// A string representation of the current value.
        /// </summary>
        public virtual string cssText
        {
            get
            {
                return _cssText != null ? _cssText.Value : "";
            }
            set
            {
                _cssText = new StringLookup(value);
            }
        }
        internal StringLookup _cssText;

        /// <summary>
        /// A code defining the type of the value as defined below:
        /// 
        /// CSS_CUSTOM
        ///     The value is a custom value.
        /// CSS_INHERIT
        ///     The value is inherited and the cssText contains "inherit".
        /// CSS_PRIMITIVE_VALUE
        ///     The value is a primitive value and an instance of the 
        ///     CSSPrimitiveValue interface can be obtained by using 
        ///     binding-specific casting methods on this instance of 
        ///     the CSSValue interface.
        /// CSS_VALUE_LIST
        ///     The value is a CSSValue list and an instance of the 
        ///     CSSValueList interface can be obtained by using 
        ///     binding-specific casting methods on this instance 
        ///     of the CSSValue interface.
        /// </summary>
        public virtual int cssValueType
        {
            get;
            internal set;
        }

        #endregion
    }
}
